﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.SupportedRenderingFeatures
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Describes the rendering features supported by a given render pipeline.</para>
  /// </summary>
  public class SupportedRenderingFeatures
  {
    private static SupportedRenderingFeatures s_Active = new SupportedRenderingFeatures();

    /// <summary>
    ///   <para>Get / Set a SupportedRenderingFeatures.</para>
    /// </summary>
    public static SupportedRenderingFeatures active
    {
      get
      {
        if (SupportedRenderingFeatures.s_Active == null)
          SupportedRenderingFeatures.s_Active = new SupportedRenderingFeatures();
        return SupportedRenderingFeatures.s_Active;
      }
      set => SupportedRenderingFeatures.s_Active = value;
    }

    /// <summary>
    ///   <para>Flags for supported reflection probes.</para>
    /// </summary>
    public SupportedRenderingFeatures.ReflectionProbeModes reflectionProbeModes { get; set; } = SupportedRenderingFeatures.ReflectionProbeModes.None;

    /// <summary>
    ///   <para>This is the fallback mode if the mode the user had previously selected is no longer available. See SupportedRenderingFeatures.mixedLightingModes.</para>
    /// </summary>
    public SupportedRenderingFeatures.LightmapMixedBakeModes defaultMixedLightingModes { get; set; } = SupportedRenderingFeatures.LightmapMixedBakeModes.None;

    /// <summary>
    ///   <para>Specifies what LightmapMixedBakeModes that are supported. Please define a SupportedRenderingFeatures.defaultMixedLightingModes in case multiple modes are supported.</para>
    /// </summary>
    public SupportedRenderingFeatures.LightmapMixedBakeModes mixedLightingModes { get; set; } = SupportedRenderingFeatures.LightmapMixedBakeModes.IndirectOnly | SupportedRenderingFeatures.LightmapMixedBakeModes.Subtractive | SupportedRenderingFeatures.LightmapMixedBakeModes.Shadowmask;

    /// <summary>
    ///   <para>What baking types are supported. The unsupported ones will be hidden from the UI. See LightmapBakeType.</para>
    /// </summary>
    public LightmapBakeType lightmapBakeTypes { get; set; } = LightmapBakeType.Realtime | LightmapBakeType.Baked | LightmapBakeType.Mixed;

    /// <summary>
    ///   <para>Specifies what modes are supported. Has to be at least one. See LightmapsMode.</para>
    /// </summary>
    public LightmapsMode lightmapsModes { get; set; } = LightmapsMode.CombinedDirectional;

    /// <summary>
    ///   <para>Determines if Enlighten Baked Global Illumination lightmapper is supported. If it is not supported, Enlighten-specific settings do not appear in the Editor, which then defaults to the CPU Lightmapper.</para>
    /// </summary>
    public bool enlightenLightmapper { get; set; } = true;

    /// <summary>
    ///   <para>Determines if Enlighten Realtime Global Illumination lightmapper is supported by the currently selected pipeline. If it is not supported, Enlighten-specific settings do not appear in the Editor, which then defaults to the CPU Lightmapper.</para>
    /// </summary>
    public bool enlighten { get; set; } = true;

    /// <summary>
    ///   <para>Are light probe proxy volumes supported?</para>
    /// </summary>
    public bool lightProbeProxyVolumes { get; set; } = true;

    /// <summary>
    ///   <para>Are motion vectors supported?</para>
    /// </summary>
    public bool motionVectors { get; set; } = true;

    /// <summary>
    ///   <para>Can renderers support receiving shadows?</para>
    /// </summary>
    public bool receiveShadows { get; set; } = true;

    /// <summary>
    ///   <para>Are reflection probes supported?</para>
    /// </summary>
    public bool reflectionProbes { get; set; } = true;

    /// <summary>
    ///   <para>If this property is true, the blend distance field in the Reflection Probe Inspector window is editable.</para>
    /// </summary>
    public bool reflectionProbesBlendDistance { get; set; } = true;

    /// <summary>
    ///   <para>Determines if the renderer supports renderer priority sorting.</para>
    /// </summary>
    public bool rendererPriority { get; set; } = false;

    /// <summary>
    ///   <para>Determines whether the function to render UI overlays is called by SRP and not by the engine.</para>
    /// </summary>
    public bool rendersUIOverlay { get; set; }

    /// <summary>
    ///   <para>Determines if the renderer will override the Environment Lighting and will no longer need the built-in UI for it.</para>
    /// </summary>
    public bool overridesEnvironmentLighting { get; set; } = false;

    /// <summary>
    ///   <para>Determines if the renderer will override the fog settings in the Lighting Panel and will no longer need the built-in UI for it.</para>
    /// </summary>
    public bool overridesFog { get; set; } = false;

    /// <summary>
    ///   <para>Specifies whether the render pipeline overrides the real-time Reflection Probes settings in the Quality settings. If It does, the render pipeline does not need the built-in UI for real-time Reflection Probes settings.</para>
    /// </summary>
    public bool overridesRealtimeReflectionProbes { get; set; } = false;

    /// <summary>
    ///   <para>Determines if the renderer will override halo and flare settings in the Lighting Panel and will no longer need the built-in UI for it.</para>
    /// </summary>
    public bool overridesOtherLightingSettings { get; set; } = false;

    /// <summary>
    ///   <para>Determines whether the Scriptable Render Pipeline will override the default Material’s Render Queue settings and, if true, hides the Render Queue property in the Inspector.</para>
    /// </summary>
    public bool editableMaterialRenderQueue { get; set; } = true;

    /// <summary>
    ///   <para>Specifies whether the renderer overrides the LOD bias settings in the Quality Settings Panel. If It does, the renderer does not need the built-in UI for LOD bias settings.</para>
    /// </summary>
    public bool overridesLODBias { get; set; } = false;

    /// <summary>
    ///   <para>Specifies whether the renderer overrides the maximum LOD level settings in the Quality Settings Panel. If It does, the renderer does not need the built-in UI for maximum LOD level settings.</para>
    /// </summary>
    public bool overridesMaximumLODLevel { get; set; } = false;

    /// <summary>
    ///   <para>Determines whether the Renderer supports probe lighting.</para>
    /// </summary>
    public bool rendererProbes { get; set; } = true;

    /// <summary>
    ///   <para>Determines if the renderer supports Particle System GPU instancing.</para>
    /// </summary>
    public bool particleSystemInstancing { get; set; } = true;

    /// <summary>
    ///   <para>Determines if this renderer supports automatic ambient probe generation.</para>
    /// </summary>
    public bool autoAmbientProbeBaking { get; set; } = true;

    /// <summary>
    ///   <para>Determines if this renderer supports automatic default reflection probe generation.</para>
    /// </summary>
    public bool autoDefaultReflectionProbeBaking { get; set; } = true;

    /// <summary>
    ///   <para>Specifies whether the render pipeline overrides the Shadowmask settings in the Quality settings.</para>
    /// </summary>
    public bool overridesShadowmask { get; set; } = false;

    /// <summary>
    ///   <para>Describes where the Shadowmask settings are located if SupportedRenderingFeatures.overridesShadowmask is set to true.</para>
    /// </summary>
    public string overrideShadowmaskMessage { get; set; } = "";

    /// <summary>
    ///   <para>A message that tells the user where the Shadowmask settings are located. </para>
    /// </summary>
    public string shadowmaskMessage
    {
      get
      {
        return !this.overridesShadowmask ? "The Shadowmask Mode used at run time can be set in the Quality Settings panel." : this.overrideShadowmaskMessage;
      }
    }

    internal static unsafe MixedLightingMode FallbackMixedLightingMode()
    {
      MixedLightingMode mixedLightingMode;
      SupportedRenderingFeatures.FallbackMixedLightingModeByRef(new IntPtr((void*) &mixedLightingMode));
      return mixedLightingMode;
    }

    [RequiredByNativeCode]
    internal static unsafe void FallbackMixedLightingModeByRef(IntPtr fallbackModePtr)
    {
      MixedLightingMode* mixedLightingModePtr = (MixedLightingMode*) (void*) fallbackModePtr;
      if (SupportedRenderingFeatures.active.defaultMixedLightingModes != SupportedRenderingFeatures.LightmapMixedBakeModes.None && (SupportedRenderingFeatures.active.mixedLightingModes & SupportedRenderingFeatures.active.defaultMixedLightingModes) == SupportedRenderingFeatures.active.defaultMixedLightingModes)
      {
        switch (SupportedRenderingFeatures.active.defaultMixedLightingModes)
        {
          case SupportedRenderingFeatures.LightmapMixedBakeModes.Subtractive:
            *mixedLightingModePtr = MixedLightingMode.Subtractive;
            break;
          case SupportedRenderingFeatures.LightmapMixedBakeModes.Shadowmask:
            *mixedLightingModePtr = MixedLightingMode.Shadowmask;
            break;
          default:
            *mixedLightingModePtr = MixedLightingMode.IndirectOnly;
            break;
        }
      }
      else if (SupportedRenderingFeatures.IsMixedLightingModeSupported(MixedLightingMode.Shadowmask))
        *mixedLightingModePtr = MixedLightingMode.Shadowmask;
      else if (SupportedRenderingFeatures.IsMixedLightingModeSupported(MixedLightingMode.Subtractive))
        *mixedLightingModePtr = MixedLightingMode.Subtractive;
      else
        *mixedLightingModePtr = MixedLightingMode.IndirectOnly;
    }

    internal static unsafe bool IsMixedLightingModeSupported(MixedLightingMode mixedMode)
    {
      bool flag;
      SupportedRenderingFeatures.IsMixedLightingModeSupportedByRef(mixedMode, new IntPtr((void*) &flag));
      return flag;
    }

    [RequiredByNativeCode]
    internal static unsafe void IsMixedLightingModeSupportedByRef(
      MixedLightingMode mixedMode,
      IntPtr isSupportedPtr)
    {
      bool* flagPtr = (bool*) (void*) isSupportedPtr;
      if (!SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Mixed))
        *flagPtr = false;
      else
        *flagPtr = mixedMode == MixedLightingMode.IndirectOnly && (SupportedRenderingFeatures.active.mixedLightingModes & SupportedRenderingFeatures.LightmapMixedBakeModes.IndirectOnly) == SupportedRenderingFeatures.LightmapMixedBakeModes.IndirectOnly || mixedMode == MixedLightingMode.Subtractive && (SupportedRenderingFeatures.active.mixedLightingModes & SupportedRenderingFeatures.LightmapMixedBakeModes.Subtractive) == SupportedRenderingFeatures.LightmapMixedBakeModes.Subtractive || mixedMode == MixedLightingMode.Shadowmask && (SupportedRenderingFeatures.active.mixedLightingModes & SupportedRenderingFeatures.LightmapMixedBakeModes.Shadowmask) == SupportedRenderingFeatures.LightmapMixedBakeModes.Shadowmask;
    }

    internal static unsafe bool IsLightmapBakeTypeSupported(LightmapBakeType bakeType)
    {
      bool flag;
      SupportedRenderingFeatures.IsLightmapBakeTypeSupportedByRef(bakeType, new IntPtr((void*) &flag));
      return flag;
    }

    [RequiredByNativeCode]
    internal static unsafe void IsLightmapBakeTypeSupportedByRef(
      LightmapBakeType bakeType,
      IntPtr isSupportedPtr)
    {
      bool* flagPtr = (bool*) (void*) isSupportedPtr;
      if (bakeType == LightmapBakeType.Mixed && (!SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked) || SupportedRenderingFeatures.active.mixedLightingModes == SupportedRenderingFeatures.LightmapMixedBakeModes.None))
      {
        *flagPtr = false;
      }
      else
      {
        *flagPtr = (SupportedRenderingFeatures.active.lightmapBakeTypes & bakeType) == bakeType;
        if (bakeType != LightmapBakeType.Realtime || SupportedRenderingFeatures.active.enlighten)
          return;
        *flagPtr = false;
      }
    }

    internal static unsafe bool IsLightmapsModeSupported(LightmapsMode mode)
    {
      bool flag;
      SupportedRenderingFeatures.IsLightmapsModeSupportedByRef(mode, new IntPtr((void*) &flag));
      return flag;
    }

    [RequiredByNativeCode]
    internal static unsafe void IsLightmapsModeSupportedByRef(
      LightmapsMode mode,
      IntPtr isSupportedPtr)
    {
      *(sbyte*) (void*) isSupportedPtr = (sbyte) ((SupportedRenderingFeatures.active.lightmapsModes & mode) == mode);
    }

    internal static unsafe bool IsLightmapperSupported(int lightmapper)
    {
      bool flag;
      SupportedRenderingFeatures.IsLightmapperSupportedByRef(lightmapper, new IntPtr((void*) &flag));
      return flag;
    }

    [RequiredByNativeCode]
    internal static unsafe void IsLightmapperSupportedByRef(int lightmapper, IntPtr isSupportedPtr)
    {
      *(bool*) (void*) isSupportedPtr = lightmapper != 0 || SupportedRenderingFeatures.active.enlightenLightmapper;
    }

    [RequiredByNativeCode]
    internal static unsafe void IsUIOverlayRenderedBySRP(IntPtr isSupportedPtr)
    {
      *(sbyte*) (void*) isSupportedPtr = (sbyte) SupportedRenderingFeatures.active.rendersUIOverlay;
    }

    [RequiredByNativeCode]
    internal static unsafe void IsAutoAmbientProbeBakingSupported(IntPtr isSupportedPtr)
    {
      *(sbyte*) (void*) isSupportedPtr = (sbyte) SupportedRenderingFeatures.active.autoAmbientProbeBaking;
    }

    [RequiredByNativeCode]
    internal static unsafe void IsAutoDefaultReflectionProbeBakingSupported(IntPtr isSupportedPtr)
    {
      *(sbyte*) (void*) isSupportedPtr = (sbyte) SupportedRenderingFeatures.active.autoDefaultReflectionProbeBaking;
    }

    internal static unsafe int FallbackLightmapper()
    {
      int num;
      SupportedRenderingFeatures.FallbackLightmapperByRef(new IntPtr((void*) &num));
      return num;
    }

    [RequiredByNativeCode]
    internal static unsafe void FallbackLightmapperByRef(IntPtr lightmapperPtr)
    {
      *(int*) (void*) lightmapperPtr = 1;
    }

    /// <summary>
    ///   <para>Determines if the renderer supports terrain detail rendering.</para>
    /// </summary>
    [Obsolete("terrainDetailUnsupported is deprecated.")]
    public bool terrainDetailUnsupported
    {
      get => true;
      set
      {
      }
    }

    /// <summary>
    ///   <para>Supported modes for ReflectionProbes.</para>
    /// </summary>
    [Flags]
    public enum ReflectionProbeModes
    {
      /// <summary>
      ///   <para>Default reflection probe support.</para>
      /// </summary>
      None = 0,
      /// <summary>
      ///   <para>Rotated reflection probes are supported.</para>
      /// </summary>
      Rotation = 1,
    }

    /// <summary>
    ///   <para>Same as MixedLightingMode for baking, but is used to determine what is supported by the pipeline.</para>
    /// </summary>
    [Flags]
    public enum LightmapMixedBakeModes
    {
      /// <summary>
      ///   <para>No mode is supported.</para>
      /// </summary>
      None = 0,
      /// <summary>
      ///   <para>Same as MixedLightingMode.IndirectOnly but determines if it is supported by the pipeline.</para>
      /// </summary>
      IndirectOnly = 1,
      /// <summary>
      ///   <para>Same as MixedLightingMode.Subtractive but determines if it is supported by the pipeline.</para>
      /// </summary>
      Subtractive = 2,
      /// <summary>
      ///   <para>Determines what is supported by the rendering pipeline. This enum is similar to MixedLightingMode.</para>
      /// </summary>
      Shadowmask = 4,
    }
  }
}
